package com.my.chapter10;

public class practice12 {
    public static void main(String[] args) {
        Outer12 o = new Outer12();
        D d = o.getD(6);
        d.alter();
    }
}

interface D{
    void alter();
}

class Outer12{
    private int x = 3;
    private void display(){
        System.out.println("x= "+x);
    }
    D getD(final int y){
        return new D(){

            @Override
            public void alter() {
                x = y;
                display();
            }
        };
    }
}

